<?php
	class Traduce {
		var $socket;
		var $expl;
		function __construct($socket, $expl, $string) {
			$this->socket = $socket;
			$string1 = explode(' ',$string);
			$string1 = str_replace('auto', '', $string1);
			
			$string2 = $string1;
			unset($string2[0]);
			$text1 = implode(' ',$string2);
			$text = urlencode(trim($text1));
			
			$url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=".$text."&langpair=".$string1[0];
			$trans = @file_get_contents($url);
			
			$translate = explode('translatedText":"',$trans);
			$traducido = explode('"', $translate[1]);
			
			IRCBot::enviar_dat('PRIVMSG', $expl[2]." :".$traducido[0]."\r\n");
		}
	}
?>